import { Map } from "immutable"; // 深拷贝state 
import * as actionTypes from "../types/find";

const initialState = Map({
  activity:[],
  news:[],
  play:{},
  APIRes:{}
})

export default function reducer(state = initialState, action) {
    switch (action.type) {
      case actionTypes.REQUEST_ACTIVITY_CENTER :
        state = state.set("activity",action.data.datas.list)
        break;

      case actionTypes.REQUEST_NEWS_LIST :
        state = state.set("news",action.data.list)
        break;

     
      case actionTypes.REQUEST_PLAY_LIST :
        let play = state.get("play")
        play[action.data.datas.ruleCode] = action.data.datas;
        state = state.set("play",play)
        state = state.set("APIRes" , action.data) // 如果就设置上面那种对象的方式 state改变了 但是redux不会通知component去rander
        break;
      default:
        return state
    }
    return state
}